home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Aug 90 / MacApp.Tech$ 8⁄3⁄90 / 1660-Re QD region data st-Jul90 next >
Encoding:
Text File  |  1991-03-06  |  3.7 KB  |  94 lines  |  [TEXT/GEOL]

  1. Item    8920476                         28-July-90        05:34PDT
  2.  
  3. From:   POWERUP.ENG                     Power Up Software,PRT
  4.  
  5. To:     ATKINSON1                       Atkinson, Bill,VCA
  6.         MACAPP.TECH$                    MacApp Technical
  7.  
  8. Sub:    RE>QD region data structu
  9.  
  10. Attn: Bill Atkinson
  11. Attn:   MacApp.Tech$
  12. SentBy: James Plamondon
  13. Date   7/27/90
  14. Subject    RE>QD region data structure
  15. From   James Plamondon
  16. To Macintosh Developer Tech Supt
  17. CC Bill Atkinson,   MacApp.Tech$
  18.  
  19. Subject:   RE>QD region data structure
  20. Dear Mr. Collyer,
  21.  
  22. I am truly saddened by the gist of your response (item 8760782) to my link
  23. regarding documentation of the region data structure, in which you said,
  24. basically, that I was SOL.  However, if that's the way it is, then that's the
  25. way it is.
  26.  
  27. I do have a suggestion, however:  add an EachPointInRegionDo() procedure to
  28. the Toolbox.  Such a procedure would make the region structure even more
  29. powerful, and its uses more diverse.
  30.  
  31. I am not the only one who needs such a procedure; here's an example of how
  32. Apple itself is already suffering for the lack of it.
  33.  
  34. The region data structure is used by MacApp's TGridView class to help with
  35. selection.  Each cell in the grid corresponds to a point (potentially) in a
  36. region.  To iterate through the cells of the selection, TGridView has a method
  37. called TGridView.EachInRgn().  This routine is implemented in the only manner
  38. possible, given the position of Apple vis-a-vis regions:  as double loop,
  39. calling PtInRgn() on each column of each row in the region's bounding box.
  40.  
  41. If, for example, only two cells were selected, those being (1, 1) and (100,
  42. 100), then 10,000 calls to PtInRgn() will be made to find these two cells.
  43. This implementation is incredibly inefficient, making this use of regions
  44. almost pointless.
  45.  
  46. On the other hand, by implementing a Toolbox routine which examined the region
  47. data structure directly, Apple could speed up this and similar uses of regions
  48. tremendously.  The routine would have to be updated whenever the region data
  49. structure changed, of course, but that is true of all of the Toolbox's current
  50. region-manipulating routines, as well.
  51.  
  52. Given these advantages, I suggest the following procedure definition for your
  53. consideration:
  54.  
  55. PROCEDURE EachPointInRegionDo(
  56.                             theRegion:      RgnHandle;
  57.                             doToPoint:      ProcPtr;
  58.                             param:           UNIV LONGINT);
  59.  
  60. in which doToPoint must point to a procedure with the following definition:
  61.  
  62. PROCEDURE DoToPoint(
  63.                             thePoint:        Point;
  64.                             param:           UNIV LONGINT);
  65.  
  66. The 'param' actual argument could be any 32-bit entity.  It would be ignored
  67. by EachPointInRegionDo() except in that it would be passed along to
  68. DoToPoint() unchanged.  The 'param' argument can thus be used to supply
  69. context to the DoToPoint() routine, e.g. via a record pointer or an object
  70. reference.
  71.  
  72. Alternatively, DoToPoint() could be passed to EachPointInRegionDo() as a
  73. procedure argument, as follows:
  74.  
  75. PROCEDURE EachPointInRegionDo(
  76.                             theRegion:      RgnHandle;
  77.                             PROCEDURE DoToPoint(
  78.                                         thePoint:          Point));
  79.  
  80. I'd actually prefer this, but I expect that the C faction will disagree — and
  81. I can see their point.
  82.  
  83. I hope that you will treat this suggestion with the seriousness that I feel it
  84. deserves.  If you want a second opinion, show this link and
  85. TGridView.EachInRgn() to Steve Friedrich, and I'll bet you dollars to donuts
  86. he'll agree with me.
  87.  
  88. Doing my best to help increase the value of Apple's patents, I remain
  89.  
  90. Yours,
  91.  
  92. James Plamondon
  93.  
  94.